package org.zoomdev.zoom;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.zoomdev.zoom.security.SensitiveUtils;

import java.io.IOException;

public class PhoneSerializer extends StdSerializer<String> {


    protected PhoneSerializer() {
        super(String.class);
    }

    @Override
    public void serialize(String s, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
        jsonGenerator.writeString(SensitiveUtils.phone(s));
    }
}